import { ProCard, ProColumns, ProForm, ProFormDatePicker, ProFormSelect, ProFormText, ProFormTextArea, ProTable } from "@ant-design/pro-components";
import { Col, Row } from "antd";
import moment from "moment";

const App:React.FC=()=>{
    interface DataType{
        sno?:number,code?:string,name?:string,invstd?:string,status?:string,munit_name?:string,quantity?:number,
        degree?:string,memo?:string,returndate?:string,warehouse?:string,borrowdate?:string,
     };

     const columns:ProColumns<DataType>[]=[
        {dataIndex:'sno',title:'序'},{dataIndex:'warehouse',title:'仓库'},
        {dataIndex:'code',title:'备品备件编码'},{dataIndex:'name',title:'名称'},
        {dataIndex:'invstd',title:'规格型号'},{dataIndex:'munit_name',title:'单位'},
        {dataIndex:'quantity',title:'数量'},{dataIndex:'degree',title:'等级'},
        {dataIndex:'memo',title:'用途'},
        {dataIndex:'borrowdate',title:'借用日期',valueType:'date'},
        {dataIndex:'returndate',title:'归还日期',valueType:'date'},
        {dataIndex:'status',title:'状态'},
     ];

     const tdata:DataType[]=[
        {sno:1,code:'A0001',name:'XX齿轮组',invstd:'200*56-60',status:'正常',munit_name:'套',borrowdate:'2025-02-10',
         quantity:1,degree:'A',memo:'维修借用',returndate:'2025-03-10',warehouse:'备件仓'},
         {sno:2,code:'ZC0081',name:'XX轴承',invstd:'500*60',status:'正常',munit_name:'只',borrowdate:'2025-02-10',
            quantity:5,degree:'B',memo:'维修借用',returndate:'2025-03-10',warehouse:'备件仓'},
            
                {sno:3,code:'CDK006',name:'XX传送带',invstd:'90*150',status:'正常',munit_name:'条',borrowdate:'2025-03-06',
                    quantity:1,degree:'B',memo:'紧急维修借用',returndate:'2025-03-20',warehouse:'备件仓'},
                    {sno:4,code:'YB2006',name:'高精水平仪',invstd:'GSD9009',status:'正常',munit_name:'台',borrowdate:'2025-03-09',
                        quantity:1,degree:'B',memo:'检测借用',returndate:'2025-03-20',warehouse:'仪器仪表仓'},
                   
        
     ];

    return <>
         <ProCard title='归还单' style={{height:700}}
         >
            <ProForm submitter={false} layout='horizontal' labelAlign="left" labelCol={{span:5,offset:0}}>
               <Row gutter={8}>
                  <Col span={6}>
                     <ProFormText name='f1' label='借用单号' width={200}/>
                     <ProFormText name='f21' label='借用类型' width={200}/>
                  </Col>
                  <Col span={6}>
                     <ProFormSelect name='f3' label='借用部门' width={200}/>
                     <ProFormText name='f4' label='借用人' width={200}/>
                  </Col>
                  <Col span={6}>
                     <ProFormText name='f5' label='借出部门' width={200}/>
                     <ProFormText name='f6' label='借出人' width={200}/>
                  </Col>
                  <Col span={6}>
                     <ProFormDatePicker name='f7' label='制单日期' width={200}  />
                     <ProFormText name='f8' label='制单人' width={200}  />
                  </Col>
                </Row> 
            </ProForm>
             <ProTable<DataType>
                search={false}
                options={false}
                columns={columns}
                dataSource={tdata}

                />
         </ProCard>
    </>;
};

export default App;